﻿@model Gtkj.CMS.Model.AdminInfo
@{
    ViewBag.Title = "修改用户 ";
    Layout = "~/Views/Shared/Master.cshtml";
}
@section js
    {
    <script src="~/Content/layer/layer.js"></script>

}
<div class="page-content">
    <!-- BEGIN PAGE HEADER-->
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li>
                <a href="~/Home/Main">首页</a>
                <i class="fa fa-angle-double-right"></i>
            </li>
            <li>
                <a href="#">修改用户</a>
                <i class="fa fa-angle-double-right"></i>
            </li>
        </ul>
    </div>
    <!-- BEGIN PAGE TITLE-->
    <h3 class="page-title">
        修改用户
    </h3>
    <!--biaoge-->
    <div class="portlet light bordered">
        <div class="portlet-title">
            <div class="caption"><i class="icon-settings font-yellow-casablanca"></i><span class="caption-subject bold font-yellow-casablanca">修改用户</span></div>
        </div>
        <!--添加代码开始-->
        <div class="portlet-body form">
            <!-- BEGIN FORM-->
            <form action="#" class="form-horizontal">
                @Html.HiddenFor(e=>e.Id)
                <div class="form-body">
                    <div class="form-group">
                        <label class="control-label col-md-4">
                            登录账号<span class="required"> * </span>
                        </label>
                        <div class="col-md-3">
                            <input type="text" name="name" id="Account" value="@Model.Account"  class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-4">
                            登录密码<span class="required"> * </span>
                        </label>
                        <div class="col-md-3">
                            <input type="password" name="name" id="PassWord" value="@Model.PassWord" autocomplete="off" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-4">
                            用户姓名<span class="required"> * </span>
                        </label>
                        <div class="col-md-3">
                            <input type="text" name="name" id="UserName" value="@Model.UserName" data-required="1" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-4">
                            账号权限<span class="required"> * </span>
                        </label>
                        <div class="col-md-3">
                            @Html.CheckBoxFor(e => e.IsAdmin, new { @data_size = "small", @id = "IsAdmin", @class = "make-switch", @data_on_text = "管理员", data_off_text = "子账号" })
                            @*<input type="checkbox" data-size="small" id="IsAdmin" class="make-switch" checked data-on-text="管理员" data-off-text="子账号">*@
                        </div>
                    </div>


                </div>
                <div class="form-actions">
                    <div class="row">
                        <div class="col-md-offset-4 col-md-8">
                            <button type="button" onclick="AddUser();" class="btn btn-primary"><span class="glyphicon glyphicon-ok"> </span> 提交</button>
                            <button type="button" class="btn default"><span class="glyphicon glyphicon-remove" onclick="window.history.go(-1);"> </span> 取消</button>
                        </div>
                    </div>
                </div>
            </form>
            <!-- END FORM-->
        </div>
    </div>
</div>
<script>
    function AddUser() {
        $.ajax({
            url: "/Home/AddUserOn",
            data: {
                Id: $("#Id").val(),
                Account: $("#Account").val(),
                PassWord: $("#PassWord").val(),
                UserName: $("#UserName").val(),
                IsAdmin: $("#IsAdmin").is(':checked')
            },
            type: "post",
            success: function (result) {
                if (result.success == true) {
                    location.href = "/Home/AdminInfoList";
                } else {
                    layer.msg(result.msg);
                }

            }
        });
    }
</script>